<?php 
	require_once 'include/comm.inc.php';
	require_once 'functions.php';
	
	if ($_POST['submit']){
		if (empty($_POST['name'])||empty($_POST['password'])){
			echo "<script language='JavaScript'>alert('用户名密码不能为空')</script>";
		}else {
			$user_info_sql="SELECT * FROM agency_user WHERE `agency_user_name`='".$_POST['name']."'";
			$user_info_return=$db->query($user_info_sql);
			$user_info_return=$db->fetch_array($user_info_return);
			
			
			$ps=md5(trim($_POST['password'])."&abc");
			if ($ps==$user_info_return['agency_user_ps']){echo "test";
				$_SESSION['agency_user_name']=$_POST['name'];
				$_SESSION['agency_user_id']=$user_info_return['agency_user_id'];
				redirect('index.php');
			}else {
				echo "<script language='JavaScript'>alert('用户名或密码不对')</script>";
			}
		}
	}
	
	
	

?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body background="../Public/images/mainbg1.gif">
<div style="width:600px; height:300px; background:url(../Public/images/mainbg.png); margin:0 auto; margin-top:130px; ">
<form action="login.php" method="post">

<table  style=" float:left; width:600px; margin-top:80px; line-height:28px; font-size:14px; ">

<tr><td style=" width:220px; text-align:right; ">用户名：</td><td> <input type="text" name="name"></td></tr>
<tr><td align="right">密码：</td><td><input type="password" name="password"/></td></tr>
 <tr><td></td><td> <input type="submit" name="submit" value="登录"></td></tr>
 </table>
</form>

</div>
</body>
</html>
--><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>管理平台</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	overflow:hidden;
}
.STYLE3 {color: #528311; font-size: 12px; }
.STYLE4 {
	color: #42870a;
	font-size: 12px;
}
-->
</style></head>

<body>
<form action="login.php" method="post">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#e5f6cf">&nbsp;</td>
  </tr>
  <tr>
    <td height="608" background="images/login_03.gif"><table width="862" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="266" background="images/login_04.gif">&nbsp;</td>
      </tr>
      <tr>
        <td height="95"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="424" height="95" background="images/login_06.gif">&nbsp;</td>
            
            <td width="183" background="images/login_07.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="21%" height="30"><div align="center"><span class="STYLE3">用户</span></div></td>
                <td width="79%" height="30"><input type="text" name="name"  style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;"></td>
              </tr>
              <tr>
                <td height="30"><div align="center"><span class="STYLE3">密码</span></div></td>
                <td height="30"><input type="password" name="password"  style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;"></td>
              </tr>
              <tr>
                <td height="30">&nbsp;</td>
                <td height="30"><input type="submit" name="submit" value="登录"></td>
              </tr>
            </table></td>
            
            <td width="255" background="images/login_08.gif">&nbsp;</td>
           
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="247" valign="top" background="images/login_09.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="22%" height="30">&nbsp;</td>
            <td width="56%">&nbsp;</td>
            <td width="22%">&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="44%" height="20">&nbsp;</td>
                <td width="56%" class="STYLE4">版本 2013V1.0 </td>
              </tr>
            </table></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#a2d962">&nbsp;</td>
  </tr>
</table>
 </form>
</body>
</html>
